home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / Java / test.java < prev   
Text File  |  1997-08-09  |  2KB  |  88 lines

  1.  
  2. import java.io.*;
  3.  
  4. public class test {
  5.  
  6.     public static void main(String[] args) throws IOException, Pdapilot.DlpException {
  7.         System.out.println("Compiled with pilot-link " + 
  8.             Pdapilot.constants.PILOT_LINK_VERSION + "." +
  9.             Pdapilot.constants.PILOT_LINK_MAJOR + "." +
  10.             Pdapilot.constants.PILOT_LINK_MINOR);
  11.             
  12.         System.out.print("Port to use [/dev/cua3]? ");
  13.         System.out.flush();
  14.         
  15.         String port = Pdapilot.Util.readLine();
  16.         if (port.equals("")) {
  17.             port = "/dev/cua3";
  18.         }
  19.         System.out.println("Please hit the HotSync button now.");
  20.         
  21.         Pdapilot.Socket x = new Pdapilot.Socket(port);
  22.         Pdapilot.Dlp y = x.accept();
  23.         
  24.         System.out.println(y.getTime().toString());
  25.         System.out.println(y.getUserInfo().toString());
  26.         System.out.println(y.getSysInfo().toString());
  27.         //System.out.println(y.getNetInfo().toString());
  28.         
  29.         for (int i=0;;i++) {
  30.             Pdapilot.CardInfo c = y.getCardInfo(i);
  31.             if (c == null)
  32.                 break;
  33.             System.out.println("Card #" + i + ": " + c.toString() );
  34.         }
  35.  
  36.         for (int i=0;;i++) {
  37.             Pdapilot.DBInfo d = y.getDBInfo(i, true, true, 0);
  38.             if (d == null)
  39.                 break;
  40.             System.out.println("DB #" + i + ": " + d.toString() );
  41.         }
  42.     
  43.         
  44.         Pdapilot.DB z = y.open(new Pdapilot.appointment.Database());
  45.         
  46.         Pdapilot.RecordID ids[] = z.getRecordIDs(false, 0, 0xffff);
  47.         for (int i=0;i<ids.length;i++) {
  48.             System.out.print(ids[i].toString()+" ");
  49.         }
  50.         System.out.println("");
  51.         
  52.         System.out.println(z.getAppBlock().toString());
  53.  
  54.         Pdapilot.Pref p;
  55.  
  56.         p = z.getPref(0);
  57.         if (p != null)
  58.             System.out.println(p.toString());
  59.         p = z.getPref(1);
  60.         if (p != null)
  61.             System.out.println(p.toString());
  62.         p = z.getPref(2);
  63.         if (p != null)
  64.             System.out.println(p.toString());
  65.         p = z.getPref(3);
  66.         if (p != null)
  67.             System.out.println(p.toString());
  68.         
  69.         for (int i=0;;i++) {
  70.             Pdapilot.Record q = (Pdapilot.Record)z.getRecord(i);
  71.             if (q == null)
  72.                 break;
  73.             System.out.println("Record #" + i +": " + q.toString() );
  74.             //z.setRecord(q);
  75.         }
  76.         
  77.         Pdapilot.expense.Record newRecord = new Pdapilot.expense.Record();
  78.         newRecord.payment = Pdapilot.expense.payment.Check;
  79.         
  80.         System.out.println(newRecord);
  81.         
  82.         y.close(Pdapilot.end.Normal);
  83.         
  84.         System.out.println("Done!");
  85.     }
  86. }
  87.  
  88.